#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int cnt = 0, ans = 0;
    for(int i = 0; i < n; i++) {
        if(a[i] == 0) {
            cnt++;
        }else{
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
}

signed main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}